package com.itheima.provider.controller;

import com.itheima.provider.domain.Goods;
import com.itheima.provider.service.GoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Eureka Client （可以是提供者也可以是消费者）
 */
//@Controller + @ResponseBody HTTP请求获取请求体（处理复杂数据，比如JSON）
@RestController
@RequestMapping("/goods") //映射路径
public class GoodsController {
    @Autowired
    private GoodService goodService;

    @GetMapping("/find/{id}")
    public Goods find(@PathVariable("id") int id){
        Goods goods = goodService.find(id);

        return goods;
    }

}
